<%# Mobile toggle will only appear if a Page template has a mobile counterpart.  %>
<% if mobile_template_exists?(@page) %>
    <%
       mobile_state = session[:mobile_mode] == true ? "Mobile" : "Desktop"
    %>
    <div class="btn-group">
      <button class="btn dropdown-toggle btn-small btn-info btn-solo" data-toggle="dropdown">
        <%= mobile_state %>
        <span class="caret"></span>
      </button>
      <ul class="dropdown-menu" role="menu">
        <li><%= link_to "View as Mobile", "#{@page.path}?template=mobile", :target => "_top" %></li>
        <li><%= link_to "View as Desktop", "#{@page.path}?template=full", :target => "_top" %></li>
      </ul>
    </div>
<% end %>
